#include<stdio.h>
#include<math.h>
double funG(double x);
double funF(double x);
int main()
{
	double x,product1,product2;
	scanf("%lf",&x);
    product1 = funG(x);
	product2 = funF(product1);
	printf("%.2lf\n",product2);
	return 0;
}
double funF(double x)
{
	return fabs(x-3) + fabs(x + 1);
}
double funG(double x)
{
	return x * x -3 * x;
}
